Skip to content

Conversation

DougGregor
Copy link
Member

Warnings about unsafe uses due to an @unsafe IteratorProtocol conformance (for the implicit call to next()) could not be silenced. Follow the same path we did for the Sequence conformance (and makeIterator() call) by associating it with the unsafe on the sequence argument.

The result looks like this:

for x in unsafe y { /* ... */ }

Warnings about unsafe uses due to an @unsafe IteratorProtocol conformance
(for the implicit call to next()) could not be silenced. Follow the same
path we did for the Sequence conformance (and makeIterator() call) by
associating it with the `unsafe` on the sequence argument.

This isn't the only solution here, but it's a reasonable one.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor enabled auto-merge February 10, 2025 23:00
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit 21e7e5d into swiftlang:main Feb 11, 2025
3 checks passed
@DougGregor DougGregor deleted the unsafe-for-in branch February 11, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant